package com.tduck.cloud.datapermission.threadlocal;

import lombok.extern.slf4j.Slf4j;

/**
 * 数据过滤上下文
 *
 * @author hasee
 */
@Slf4j
public class DataScopeThreadLocal {
    private static final ThreadLocal<String> THREAD_LOCAL_DATA_FILTER = new ThreadLocal<>();

    public static void clear() {
        THREAD_LOCAL_DATA_FILTER.remove();
    }

    public static void set(String metaData) {
        THREAD_LOCAL_DATA_FILTER.set(metaData);
        THREAD_LOCAL_DATA_FILTER.set(metaData);
    }

    public static String get() {
        return THREAD_LOCAL_DATA_FILTER.get();
    }
}
